<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ImageEditor.Master" Inherits="System.Web.Mvc.ViewPage<Universum.Views.Resource.ResourceViewModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ScriptContent" runat="server">
<link type="text/css" rel="Stylesheet" href="<%=Html.ResolveUrl("~/content/css/jquery.tooltip.css") %>" />
<script language="javascript" type="text/javascript" src="<%=Html.ResolveUrl("~/content/scripts/jquery.dimensions.js") %>"></script>
	<script language="javascript" type="text/javascript" src="<%=Html.ResolveUrl("~/content/scripts/jquery.tooltip.min.js") %>"></script>
	<script language="javascript" type="text/javascript">

		$(function() {

//			$(".image-preview").tooltip({
//				delay: 0,
//				showURL: false
//				,
//				bodyHandler: function() {
//					//alert( );
//					return $("<img width='150px' heigth='150px'/>").attr("src", $("span", this).attr("class"));
//				}
//			}); // image-preview tootip
			$(".span-preview").click(function() {
				top.document.getElementById("src").value =
				$("span", this).attr("class");
				top.ImageDialog.getImageData();

			});

		});
	</script>
	
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

   <div class="span-24">
		<div class="span-24">
			<%if (Model.IsInsideFolder.IsFalse())
	 { %>
			<a href="<%= Html.BuildUrlFromExpression<ResourceController>(fromAction=>fromAction.Browse("")) %>">
				<img alt="Back to index" src="<%= new ContentDirectoryService("/images/back_to_index_ikon.png").Path %>" /></a>
			<%} %>
		</div>
		<% foreach (var directory in Model.Directories)
	 {
		%>
		<div class="span-2">
			<center>
				<%Html.BeginLink<ResourceController>(callTo => callTo.Browse(directory)); %>
				<img alt="<%=directory %>" src="<%= new ContentDirectoryService("/images/folder_ikon.png").Path %>" />
				<%--<%= Html.UserActionLink<ResourceController>(callTo=>callTo.Browse(directory),directory)%>--%>
				<br />
				<span><%=directory %></span>
				<%Html.EndLink(); %>
			</center>
		</div>
		<% } %>
		<hr class="span-16" />
		<% foreach (var key in Model.FileTypes.Keys)
	 {
		 foreach (var value in Model.FileTypes[key])
		 {
		%>
		<div class="span-4 limit-image span-preview">
			<center>			
				<% if (value.IsImage)
	   { %>
				<img alt="<%=value %>" width="48px" height="48px" src="<%= Html.RouteUrl<ResourceController>(to=>to.ShowFile(value.Id)) %>" />
				<%} else { %>
				<img alt="<%=value %>" width="48px" height="48px" src="<%= new ContentTypeRepresentationService(key).Path %>" />
				<% } %>
				<br />
				<span class="<%= Html.RouteUrl<ResourceController>(to=>to.ShowFile(value.Id)) %>">
					<%= value.FileName %></span>
			</center>
		</div>
		<% 
			}
	 } %>
	</div>

</asp:Content>
